<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image and Document Preview</title>
    <style>
        .preview-container {
            margin-top: 20px;
        }
        .preview-container img, .preview-container iframe {
            max-width: 100%;
            height: auto;
        }
        .preview-container iframe {
            height: 500px;
            border: none;
        }
    </style>
</head>
<body>
    <h1>Preview Image and Document</h1>
    
    <div>
        <h2>Image Preview</h2>
        <button onclick="showImage('path/to/your/image.jpg')">Show Image</button>
        <div class="preview-container" id="imagePreviewContainer"></div>
    </div>
    
    <div>
        <h2>Document Preview</h2>
        <button onclick="showDocument('path/to/your/document.pdf')">Show Document</button>
        <div class="preview-container" id="documentPreviewContainer"></div>
    </div>

    <script>
        function showImage(url) {
            const img = document.createElement('img');
            img.src = url;
            const container = document.getElementById('imagePreviewContainer');
            container.innerHTML = ''; // Clear previous content
            container.appendChild(img);
        }

        function showDocument(url) {
            const iframe = document.createElement('iframe');
            iframe.src = url;
            const container = document.getElementById('documentPreviewContainer');
            container.innerHTML = ''; // Clear previous content
            container.appendChild(iframe);
        }
    </script>
</body>
</html>
